
function sendEncrypt(sendData) {
    var servicePublicKey ="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcerPyjFWlg4U2ItfvWx7f06c3eySbBltl6ohm6sdn6SGsrgF1Xrw7/+ktRWzdzVDmE6epMIvPjbvqDHJThrNGS6y3MJrVV5rEKWYoomo2FIgNMb0SC+wF/LFtNyc9eFEUIpyYRYDsgfmViMKQrO4NTvfgjiwLi7aVTEhpTjHQ9wIDAQAB";
    // 获取16位随机数,当做aes秘钥key
    var randomStr = randomString(16);
    // aes加密
    // console.log(sendData);
    var data = Encrypt(sendData, randomStr);
    // rsa加密
    var encrypt = new JSEncrypt();
    encrypt.setPublicKey(servicePublicKey);
    var encrypted = encrypt.encrypt(randomStr);
    // 创建json对象
    var json = {
        "requestData": data,
        "encrypted": encrypted
    };
    return JSON.stringify(json);

}
function receiveEncrypt(result) {
    var clientPrivateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAM1cUiuKGVggCe1GetDORZdN/Cv2zKr/QiKJ1sLO6Obh6rghyfvWhGST78NC4/0AGxvg+SssUZmKmlajUDCQa+fCVDBiwEhqKO/fkKB2bWRwtW6iX1BFuhnnI+fKHmdo0WCYp4RkyHrW4PJ5UouLb3ypNC3JMmtJoFlworYmIpOhAgMBAAECgYEAkoQ5xAKljnBdZMKSQYPJtufW8O8Gm0G/R7EcXqUNGh05P+Irn9gvYSsDN0b0Lr/yl3NtktXt6iQvdXzTa7K+qLXC2R+8FEVghxuzsSesG+aE6jDmPPCRaL7N7HLYTNsWz/gj0y5D91mZOo5DxF53OqjG/Un3DI3BiiQT/9J/9PkCQQD2TLnuIDLmk2T1Ez0joFoCjmxwdqYTVi0oMWigLfWRdEunqRxZ/S6GKdEXXQ+QQvIdZNGxtg+fl142e6PbZs7rAkEA1XLVY4w1svMQXMJ0tF6UWl9JpQu0qR6HB7ptBsOEu70TG4ZSTlEFhqQTmXDX8B3ffDgYmgeg1Le41BZAt5l8owJALAfjZVKURuwqrDVYRLox3Ssg76oGXoaVZA4RKjGNKQelTr/Itb2xR4LKQmb8lUmihuazJhXqDRm+WfcYf+yNKQJAEj3zMMPN3xJY5qST1spygVq9b4aVlRKP1cBACyDwmh7poCOVqy3PfBdPuYBkZBgZfoNIzvkx7JwbBr00ILzUYwJAS5ednB0nFGjtrIobwDLzNe2m4Whgk+/e3iiUJYILi83xGlNfWHpvVaYq2xdhbt6T2cD6sv68t9mN7+XaVz0bMQ==";
    // console.log("返回的数据对象:" + result);
    // rsa解密,获取到aes秘钥
    var decrypt = new JSEncrypt();
    decrypt.setPrivateKey(clientPrivateKey);
    var aesKey = decrypt.decrypt(result.encrypted);
    // 用aes秘钥进行解密
    var resultData = Decrypt(result.requestData, aesKey);
    // console.log("解密的数据：" + resultData);
    return resultData;
}